﻿using System.Diagnostics;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Web.UI;
using Microsoft.VisualStudio.DebuggerVisualizers;
using WebVisualizers.Forms;
using WebVisualizers.ObjectSource;
using WebVisualizers.Types;

[assembly: DebuggerVisualizer(typeof(WebVisualizers.WebPageVisualizer), typeof(WebPageObjectSource), Target = typeof(Page), Description = "WebPage Visualizer")]
namespace WebVisualizers
{
    /// <summary>
    /// The Visualizer for type System.Web.UI.Page
    /// </summary>
    public class WebPageVisualizer : DialogDebuggerVisualizer
    {
        /// <summary>
        /// 
        /// </summary>
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            PageData pageData = (PageData)objectProvider.GetObject();

            //Initialize the Visualizer Form and Show the data
            using (VisualizerForm frm = new VisualizerForm())
            {
                frm.ShowVisualizer(pageData);
            }
        }
    }
}
